﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter13.Code03.Code03.Snippet02
{
    public class Demo
    {
        public static void Begin()
        {
            Connection myConnection = new Connection();
            myConnection.Name = "Three Connection.";
            myConnection.MessageArrived +=
                delegate(object source, MessageArriveEventArgs e)
                {
                    Console.WriteLine("Message arrived form: {0}", ((Connection)source).Name);
                    Console.WriteLine("Message Text: {0}", e.Message);
                };
        }
    }
}
